<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>去中心化众筹平台</title>
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <div class="container">
        <header>
            <h1>去中心化众筹平台</h1>
            <div class="wallet-info">
                <button id="connectWallet" class="btn btn-primary">连接MetaMask</button>
                <div id="walletAddress" class="wallet-address"></div>
                <div id="walletBalance" class="wallet-balance"></div>
            </div>
        </header>

        <main>
            <!-- 创建项目区域 -->
            <section class="create-project">
                <h2>创建新项目</h2>
                <form id="createProjectForm">
                    <input type="text" id="projectTitle" placeholder="项目标题" required>
                    <textarea id="projectDescription" placeholder="项目描述" rows="3" required></textarea>
                    <input type="number" id="goalAmount" placeholder="目标金额 (ETH)" step="0.001" min="0.001" required>
                    <input type="number" id="duration" placeholder="持续时间 (小时)" min="1" max="2160" required>
                    <button type="submit" class="btn btn-primary">创建项目</button>
                </form>
            </section>

            <!-- 项目列表区域 -->
            <section class="projects-section">
                <h2>所有项目</h2>
                <div class="filter-controls">
                    <button class="filter-btn active" data-filter="all">全部</button>
                    <button class="filter-btn" data-filter="active">进行中</button>
                    <button class="filter-btn" data-filter="successful">已成功</button>
                    <button class="filter-btn" data-filter="failed">已失败</button>
                </div>
                <div id="projectsList" class="projects-grid"></div>
            </section>

            <!-- 我的项目区域 -->
            <section class="my-projects">
                <h2>我的项目</h2>
                <div class="tabs">
                    <button class="tab-btn active" data-tab="created">我创建的</button>
                    <button class="tab-btn" data-tab="contributed">我投资的</button>
                </div>
                <div id="myProjectsList" class="projects-grid"></div>
            </section>
        </main>

        <!-- 项目详情模态框 -->
        <div id="projectModal" class="modal">
            <div class="modal-content">
                <span class="close">&times;</span>
                <div id="modalContent"></div>
            </div>
        </div>

        <!-- 加载提示 -->
        <div id="loader" class="loader">
            <div class="spinner"></div>
            <p>处理中...</p>
        </div>

        <!-- 消息提示 -->
        <div id="toast" class="toast"></div>
    </div>

    <script src="https://cdn.jsdelivr.net/npm/web3@1.10.0/dist/web3.min.js"></script>
    <script src="wallet-helper.js"></script>
    <script src="app.js"></script>
</body>
</html>